package com.veo.controller;

import com.veo.bean.Account;
import com.veo.bean.Users;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller("accountController")
@RequestMapping("/account")
public class AccountController {

    @RequestMapping("/findAccount")
    public String findAccount(){
        System.out.println("findAccount......");
        return "success";
    }

    @RequestMapping("/saveAccount")
    public ModelAndView saveAccount(Account account){
        System.out.println(account);
        ModelAndView mv =  new ModelAndView();
        mv.addObject("accountName",account);
        mv.setViewName("success");
        return mv;
    }

    @RequestMapping("/findAccountById")
    public ModelAndView findAccountById(String accountId){
        System.out.println("findAccountById......"+accountId);
        ModelAndView mv = new ModelAndView();
        mv.setViewName("success");
        return mv;
    }

    @RequestMapping("/saveUsers")
    public ModelAndView saveUsers(Users users){
        System.out.println("saveUsers......"+users);
        ModelAndView mv = new ModelAndView();
        mv.setViewName("success");
        return mv;
    }


    @RequestMapping("/delAccount")
    public String delAccount(@RequestParam(value = "date") Date date, HttpServletRequest request, HttpServletResponse response, HttpSession session){
        System.out.println("delAccount......" + date);
        System.out.println(request);
        System.out.println(response);
        System.out.println(session);
        return "success";
    }


}
